import React ,{ useEffect  , useState} from 'react'
import pubsub from 'pubsub-js'

export default function Didi() {
    const [car, setCar] = useState("八手奥迪")

    //在初始化的时候订阅以后都可以手到订阅
    useEffect(() => {
        pubsub.subscribe("qiche", (_ , data) => {
            setCar(data)
        })
    }, [])

    return (
        <div>
            <h1>我是弟弟,我开我哥哥的{car}</h1>
        </div>
    )
}
